/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.StateVariables.impl;

import EA_Model.IEC61970.Domain.AngleRadians;
import EA_Model.IEC61970.Domain.Voltage;

import EA_Model.IEC61970.StateVariables.StateVariablesPackage;
import EA_Model.IEC61970.StateVariables.SvVoltage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Sv Voltage</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.StateVariables.impl.SvVoltageImpl#getAngle <em>Angle</em>}</li>
 *   <li>{@link EA_Model.IEC61970.StateVariables.impl.SvVoltageImpl#getV <em>V</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SvVoltageImpl extends StateVariableImpl implements SvVoltage {
	/**
	 * The cached value of the '{@link #getAngle() <em>Angle</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getAngle()
	 * @generated
	 * @ordered
	 */
	protected AngleRadians angle;

	/**
	 * The cached value of the '{@link #getV() <em>V</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getV()
	 * @generated
	 * @ordered
	 */
	protected Voltage v;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SvVoltageImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return StateVariablesPackage.Literals.SV_VOLTAGE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AngleRadians getAngle() {
		if (angle != null && angle.eIsProxy()) {
			InternalEObject oldAngle = (InternalEObject)angle;
			angle = (AngleRadians)eResolveProxy(oldAngle);
			if (angle != oldAngle) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateVariablesPackage.SV_VOLTAGE__ANGLE, oldAngle, angle));
			}
		}
		return angle;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public AngleRadians basicGetAngle() {
		return angle;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setAngle(AngleRadians newAngle) {
		AngleRadians oldAngle = angle;
		angle = newAngle;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, StateVariablesPackage.SV_VOLTAGE__ANGLE, oldAngle, angle));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage getV() {
		if (v != null && v.eIsProxy()) {
			InternalEObject oldV = (InternalEObject)v;
			v = (Voltage)eResolveProxy(oldV);
			if (v != oldV) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, StateVariablesPackage.SV_VOLTAGE__V, oldV, v));
			}
		}
		return v;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Voltage basicGetV() {
		return v;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setV(Voltage newV) {
		Voltage oldV = v;
		v = newV;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, StateVariablesPackage.SV_VOLTAGE__V, oldV, v));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case StateVariablesPackage.SV_VOLTAGE__ANGLE:
				if (resolve) return getAngle();
				return basicGetAngle();
			case StateVariablesPackage.SV_VOLTAGE__V:
				if (resolve) return getV();
				return basicGetV();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case StateVariablesPackage.SV_VOLTAGE__ANGLE:
				setAngle((AngleRadians)newValue);
				return;
			case StateVariablesPackage.SV_VOLTAGE__V:
				setV((Voltage)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case StateVariablesPackage.SV_VOLTAGE__ANGLE:
				setAngle((AngleRadians)null);
				return;
			case StateVariablesPackage.SV_VOLTAGE__V:
				setV((Voltage)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case StateVariablesPackage.SV_VOLTAGE__ANGLE:
				return angle != null;
			case StateVariablesPackage.SV_VOLTAGE__V:
				return v != null;
		}
		return super.eIsSet(featureID);
	}

} //SvVoltageImpl
